package com.hefeng.unit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hefeng.unit.domain.GyDevice;
import com.hefeng.unit.domain.GyDeviceSon;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface SonMapper extends BaseMapper<GyDeviceSon> {

    @Select("SELECT\n" +
            "\tgy_device_son.* \n" +
            "FROM\n" +
            "\tgy_device_user\n" +
            "\tINNER JOIN gy_device ON gy_device_user.user_id = gy_device.user_id\n" +
            "\tINNER JOIN gy_device_son ON gy_device.device_code = gy_device_son.device_code \n" +
            "WHERE\n" +
            "\tgy_device_user.is_delete = 1 \n" +
            "\tAND gy_device_user.user_id = #{userId} and gy_device_son.device_type = 1")
    IPage<GyDeviceSon> selectDeviceList(@Param( "userId") String userId, IPage<GyDeviceSon> pagin);

//    IPage<GyDeviceSon> selectDeviceList(String userId, Page<GyDeviceSon> pagin);
}
